﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;

namespace Noea.Parser
{
    // HtmlDocState implements a state machine that parse html. 
    public class HTMLDocState : IHTMLDoc
    {
        private string doc;
        private string url;
        private Uri uri;
        private IList links;
        private string document;


        public HTMLDocState(string url)
        {
            this.url = url;

        }

        public string Doc
        {
            get { return doc; }
        }

        // read-only. Returns the URL of the current web-page
        public string URL
        {
            get { return url; }
        }

        // read-only property. Returns the web page as a string.
        public string Document
        {
            get { return document; }
        }


        // Returns a list of strings containing the urls of all links to pages on the this site.
        // That is: links to web pages outside this are not included
        public IList GetAllLinks()
        {
            throw new NotImplementedException();
        }

        // returns true if searchString is found in <body>...</body> in this HTML-document
        public bool Contains(string searchString)
        {
            bool isFound = false;
            for (int i = 0; i < searchString.Length; i++)
            {
                if (isFound == true)
                {
                    break;
                }
            }
            return false;
        }

        public Uri BaseUri()
        {
            url = uri.Scheme + "://" + uri.GetComponents(UriComponents.HostAndPort, UriFormat.UriEscaped);
           
            return uri;
        }



    }
}